<template>
	<view>
		<view class="m-2 p-5 rounded-20 bg-white">
			<view class="text-muted">请设置运费价格</view>
			<view class="set_freight mt-5 pt-3 pb-1 d-flex a-center">
				<view class="set_price">￥</view>
				<view class="flex-1">
					<input type="text" placeholder="0.00" class="set_price" placeholder-class="set_price" v-model="freight_price" @input="freight_input"  />
				</view>
			</view>
			<view class="pt-5 my-3 confirm" @click="confirm_next">
				<button type="warn">确定</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				freight_price:"",
			}
		},
		methods: {
			freight_input(e){
				this.freight_price=e.detail.value
				console.log(e)
			},
			confirm_next(){
				var globalData = getApp().globalData.freight; //获取全局变量
				getApp().globalData.freight= parseInt(this.freight_price).toFixed(1); //修改全局变量
				uni.navigateBack({
					delta:2
				})	
				var globalData = getApp().globalData.freight_template; //获取全局变量
				getApp().globalData.freight_template= ""; //修改全局变量
			}
		},
		onShow() {
			if(getApp().globalData.freight){
				var globalData = getApp().globalData.freight; //获取全局变量
				this.freight_price=globalData
			}
		}
	}
</script>

<style>
	.confirm /deep/ button{
		width: 90%;
		border-radius: 50upx;
		background: linear-gradient(to right,#F31E3E,#FB4F37);
	}
	.set_freight{
		border-bottom: 1px solid #b6b6b6;
	}
	.set_price{
		height: 80upx;
		font-size: 60upx;
	}
	.set_freight input{
		caret-color:#0021ff;
		font-size: 50upx;
	}
</style>
